<% layout("head.html",{title:"需求详情"}){ %>
<style type="text/css">
    .layui-row-style{font-style: italic}
    .layui-input-block{margin-left: 0px;}
    .layui-col-lg2{cursor: pointer}
    .user-name,.reply-but{color: cornflowerblue}
    .consu-content{margin-top: 8px;margin-left: 20px;margin-bottom: 8px}
    .create-time{}

</style>
<div style=" background-color: #eee">
    <div class="stick-layout container">
        <div class="center_div" style="margin-top: 120px">
            <div style="" class="left_div_menu" id="left_div_menu">
               <span>
                    <a href="/Counselling/queryCounseModelAndView?isRecetip=1" class="menu-item nuxt-link-active">
                        已接单
                    </a><br>
                   <div class="menu-divider"></div>
                    <a href="/Counselling/queryCounseModelAndView?isRecetip=0"
                       class="menu-item nuxt-link-exact-active nuxt-link-active nuxt-link-exact-active">
                       未接单
                    </a>
                </span>
            </div>
            <div class="stick-content" id="stick-content">
                <div class="demand-item">
                    <div class="tip-title">需求详情</div>
                    <div class="item-inner">
                        <% if(isNotEmpty(results)&&isNotEmpty(results.data)){%>
                            <div class="inner-header">
                                <h3>${results.data.title!}</h3>
                                <span class="city">${results.data.isReceipt=='0'?'未接单':'已接单'}</span>
                                <span class="budget-wrapper">金额
                                         <span class="budget">${results.data.payMoney!}元</span>
                                 </span>
                            </div>
                            <br>
                            <div class="inner-desc">
                                ${results.data.content!}
                            </div>
                            <div class="inner-service">
                                <i class="el-icon-icn_scene"></i>
                                服务说明：大V需要提前预约。
                            </div>
                            <div class="inner-cycle">
                                <i class="icon"></i>
                                <span class="text">${results.data.domain!}</span>
                            </div>
                            <div class="inner-footer">
                                <span class="applicant">达者类型：${results.data.grade!}</span>
                                <span class="deadline fr">时间：${results.data.createTime,dateFormat="yyyy-MM-dd HH:mm:ss"}</span>
                            </div>
                        <%}%>
                    </div>
                    <% if(isNotEmpty(reply)){%>
                        <div class="layui-row">
                            <span style="font-size: 20px;">答复:</span>
                            <div class="layui-col-lg11 layui-col-lg-offset1">
                                <% for(entityData in reply){%>
                                     <div class="layui-row layui-row-style">
                                         <div class="layui-col-lg5 user-name">${entityData.weChatName!}:</div>
                                         <div class="layui-col-lg5 create-time">${entityData.createTime,dateFormat="yyyy-MM-dd HH:mm:ss"}</div>
                                         <%if(entityDataLP.first){%>
                                            <div class="layui-col-lg2 reply-but"  id="${entityData.id!}" consuId="${results.data.id}">【回复】</div>
                                         <%}%>
                                     </div>
                                     <div  class="consu-content">
                                         ${entityData.content!}
                                     </div>
                                <%}%>
                            </div >
                        </div>
                    <%}else{%>
                        <div class="tip-title demand-item">
                            <span style="font-size: 18px">回复:</span>
                            <form class="layui-form" action="" method="post" id="layui-form">
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <textarea hidden  class="layui-textarea" name="content" id="editText" lay-verify="textLength"></textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block" style="text-align: center">
                                        <button class="layui-btn" lay-submit="" lay-filter="submit_filter">立即提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    <%}%>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    //需求列表左侧订单区域动态css设置
    dynamiCSS('stick-content','left_div_menu',100);
    layui.use(['form','layedit','jquery'], function(){
        var layedit = layui.layedit,form = layui.form,$ = jQuery = layui.$;
        var index=layedit.build('editText', {
            //设置编辑器高度
            height: 120,
            //清除一些工具
            hideTool:["link","image","face"],
            uploadImage: {
                url: '/upload/',
                type: 'post'
            }
        });
       //表单验证
        form.verify({
            textLength:function(value,domObj){
                //同步富文本
                layedit.sync(index);
            }
        });
        //表单提交验证
        form.on('submit(submit_filter)', function (data) {
            var text=layedit.getContent(index);
            if(text==''||text==""){
                layerDef('请填回复内容！',2);
                return false;
            }
            if(text.length>30000){
                layerDef('长度不得大于30000个字符',2);
                return false;
            }
           $.ajax({
                type:'post',
                url:'/reply/replyConsu/${results.data.id!}',
                contentType:'application/json',
                data:JSON.stringify(data.field),
                success:function(data){
                    closeLayeropen();
                }
            });
            return false;
        });
        $(".layui-col-lg2").click(function(){
            $.ajax({
                type:'post',
                url:'/reply/reply2Reply/getReplyFormPage?replyPid='+$(this).attr('id')+"&consuId="+$(this).attr('consuId'),
                success:function(data){
                    if(data.responseCode==undefined){
                        var indexReplyOpen=layer.open({
                            type: 1,
                            title : '回复',
                            moveType: 0,
                            resize:true,
                            maxmin:true,
                            zIndex:2147483647,
                            //skin : "layui-layer-molv",
                            border : [1],
                            area : ['50%','60%'],
                            content:data,
                        });
                    }else{
                        layerDef(data.responseDesc,5);
                    }
                }
            });
        });
    });
</script>
<%}%>